﻿@{
    ViewBag.Title = "ServiceType Maintenance";
    ViewBag.BackUrl = Url.Action("ServiceTypes", "Master");
}

@using (Html.BeginForm("ServiceTypeMaintenance", "Master", FormMethod.Post, new { onsubmit = "return ValidateForm();" }))
{
    <div class="col-md-12">

        <div class="box box-danger">
            <div class="box-body">

                <div class="box-header">
                    <h3 class="box-title">Add ServiceType</h3>
                </div>

                <div class="form-group">
                    <label> ServiceType:</label><span class="astrisk">*</span>
                    <div class="input-group">
                        <div class="input-group-addon">
                            <i class=""></i>
                        </div>
                        <input id="ServiceType" name="ServiceType" maxlength="20" type="text" class="form-control" />
                    </div><!-- /.input group -->
                </div><!-- /.form group -->


                <div class="box box-success">
                    <div class="box-footer">
                        <input type="hidden" name="Id" id="Id" />
                        <button type="submit" class="btn btn-primary" style=" width:80px;">Save</button>
                        <button type="reset" class="btn btn-primary" style=" width:80px;">Cancel</button>
                    </div>
                </div><!-- /.box -->

            </div><!-- /.box-body -->
        </div><!-- /.box -->
    </div><!-- /.col (left) -->

}

@{
    var message = TempData["AlertMessage"] ?? string.Empty;
}

<script type="text/javascript">
    var message = '@message';
    if(message)
        alert(message);
</script>


<script type="text/javascript">
    function ValidateForm() {

         RequiredTextbox("ServiceType", "Enter the ServiceType Name")

        return AlertError();
    }

    $(document).ready(function () {

        if("@ViewBag.Id" != "0")
        {
            $('#Id').val('@Model.Id');
            $('#ServiceType').val("@Model.Name");
        }
    })
</script>